package com.device.controller;

import com.device.domain.vo.StationVo;
import com.device.service.DeviceService;
import com.share.common.core.web.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.share.common.core.web.domain.AjaxResult.success;

@Tag(name = "设备管理")
@RestController
@RequestMapping("/device")
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
    //获取位置经纬度
    @Operation(summary = "获取附近站点信息列表")
    @GetMapping("/nearbyStationList/{latitude}/{longitude}")
    public AjaxResult nearbyStationList(
            @PathVariable String longitude,
            @PathVariable String latitude)
    {
        //全查获取位置的经纬度数据
        List<StationVo> list = deviceService.nearbyStationList(longitude,latitude);
        //然后将这个数据存到success 中
        AjaxResult success = success(list);
        return success;
    }

}
